package com.common.frame.base

import androidx.databinding.ViewDataBinding
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder

open class SimpleAdapter<T, VB : ViewDataBinding>(
    var beanId: Int,
    layoutId: Int,
    data: MutableList<T>? = null
) : BaseQuickAdapter<T, BaseDataBindingHolder<VB>>(layoutId, data) {
    override fun convert(holder: BaseDataBindingHolder<VB>, item: T) {
        holder.dataBinding?.setVariable(beanId, item)
        holder.dataBinding?.executePendingBindings()
    }
}